package com.niodata.dt.fs.ftp;

import java.io.IOException;
import org.apache.commons.net.ftp.FTPClient;

public class PooledFtpClient extends FTPClient {

  private final FtpClientPool pool;

  public PooledFtpClient(FtpClientPool pool) {
    this.pool = pool;
  }

  @Override
  public void disconnect() throws IOException {
    pool.releaseClient(this);
  }

  @Override
  public boolean logout() {
    //do nothing
    return true;
  }

  public void trulyLogOut() throws IOException {
    super.logout();
  }

  public void trulyDisconnect() throws IOException {
    super.disconnect();
  }
}
